﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CodeGenerator.BaseUI;
using CodeGenerator.Core;
using ICSharpCode.TextEditor.Document;
using CodeGenerator.Common;

namespace CodeGenerator.UI
{
    public partial class FrmBuildHCode : BaseFormEx
    {
        private Dictionary<string,string> content;
        public FrmBuildHCode(Dictionary<string, string> content)
        {
            InitializeComponent();

            this.content = content;
            
           // textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(style);
           // textEditorControl1.Encoding = System.Text.Encoding.Default;
        }

        private void FrmBuildHCode_Load(object sender, EventArgs e)
        {
            foreach (KeyValuePair<string, string> item in content)
            {
                if (item.Key == "entity")
                {
                    FormatCodeHelper.FormatText(textEditorControl1, FormatCodeHelper.CSHARP, item.Value);
                }
                else if (item.Key == "bll")
                {
                    FormatCodeHelper.FormatText(textEditorControl2, FormatCodeHelper.CSHARP, item.Value);
                }
                else if (item.Key == "controller")
                {
                    FormatCodeHelper.FormatText(textEditorControl3, FormatCodeHelper.CSHARP, item.Value);
                }
                else if (item.Key == "index")
                {
                    FormatCodeHelper.FormatText(textEditorControl4, FormatCodeHelper.HTML, item.Value);
                }
                else if (item.Key == "indexJs")
                {
                    FormatCodeHelper.FormatText(textEditorControl5, FormatCodeHelper.JAVASCRIPT, item.Value);
                }
                else if (item.Key == "form")
                {
                    FormatCodeHelper.FormatText(textEditorControl6, FormatCodeHelper.HTML, item.Value);
                }
                else if (item.Key == "formJs")
                {
                    FormatCodeHelper.FormatText(textEditorControl7, FormatCodeHelper.JAVASCRIPT, item.Value);
                }
            }
        }
    }
}
